/**
 * 类的定义
 */
Crab = function() {
	this.legs = 10;
};

/**
 * prototype来扩展类的功能
 * @type 
 */
Crab.prototype = {
	say:function() {
		alert('有' + this.legs + '只脚');
	}
};

//test
var crab = new Crab();
alert(crab.legs);
crab.say();

/**
 * js中的继承，即把父类的成员复制给子类
 * 
 * @param {} child 子类
 * @param {} father 父类
 */
var extend = function(child, father) {
	child.prototype = father.prototype;
};

GenCrab = function() {
	this.legs = 2;
};

extend(GenCrab, Crab);
var gc = new GenCrab();
alert(gc.legs);
gc.say();